package com.alibaba.algo.service.impl;

import com.alibaba.algo.domain.AlarmDataDomain;
import com.alibaba.algo.entity.AlarmData;
import com.alibaba.algo.service.AlarmService;
import com.alibaba.algo.vo.AlarmRequestVO;
import com.alibaba.algo.core.base.PagerEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;

@Slf4j
@Service
public class AlarmServiceImpl implements AlarmService {

    @Autowired
    private AlarmDataDomain alarmDataDomain;


    @Override
    public PagerEntity pageByPara(AlarmRequestVO alarmRequestVO) {
        LinkedHashMap<String, Object> sortMap = new LinkedHashMap<String, Object>();
        sortMap.put("subject_time", "desc");
        AlarmData alarmData = new AlarmData();
        alarmData.setStartTime(alarmRequestVO.getStartTime());
        alarmData.setEndTime(alarmRequestVO.getEndTime());
        return alarmDataDomain.pageByPara(alarmData, alarmRequestVO.getPageIndex(), alarmRequestVO.getPageSize(), sortMap);
    }

}
